x86-64: fix #GP generation in assembly code
authorJan Beulich <jbeulich@suse.com>
Tue, 17 Apr 2012 13:33:53 +0000 (15:33 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 17 Apr 2012 13:33:53 +0000 (15:33 +0200)
commit63a9a8edb97a726c87b1ce80a6f9c1493410993c
treea6ac6d7152504fe41c51ba9ab3a9acc9eef6578a
parent55fb80266efe5583fe34ac62a93cee55bd30a44b
x86-64: fix #GP generation in assembly code

When guest use of sysenter (64-bit PV guest) or syscall (32-bit PV
guest) gets converted into a GP fault (due to no callback having got
registered), we must
- honor the GP fault handler's request the keep enabled or mask event
  delivery
- not allow TBF_EXCEPTION to remain set past the generation of the
  (guest) exception in the vCPU's trap_bounce.flags, as that would
  otherwise allow for the next exception occurring in guest mode,
  should it happen to get handled in Xen itself, to nevertheless get
  bounced to the guest kernel.

Also, just like compat mode syscall handling already did, native mode
sysenter handling should, when converting to #GP, subtract 2 from the
RIP present in the frame so that the guest's GP fault handler would
see the fault pointing to the offending instruction instead of past it.

Finally, since those exception generating code blocks needed to be
modified anyway, convert them to make use of UNLIKELY_{START,END}().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/x86_64/asm-offsets.c
xen/arch/x86/x86_64/compat/entry.S
xen/arch/x86/x86_64/entry.S